package com.songVersion.controller.actions;

import com.songVersion.model.SearchedAuthor;
import com.songVersion.services.SearchManager;
import com.songVersion.services.SearchedAuthorManager;
import com.songVersion.services.impl.SearchManagerImpl;
import com.songVersion.services.impl.SearchedAuthorManagerImpl;


public class SearchAction extends GeneralAction
{

	
	public SearchAction()
	{
		super();
	}

	@Override
	public String process()
	{
		int numVersions = getVersionsInNest();
		if (numVersions > 0)
			saveSearch();
		return "/views/search.jsp";
	}
	
	private void saveSearch()
	{
		SearchManager sm = new SearchManagerImpl();
		sm.save(getSongAuthor(), getSongName());
		/*
		 * no guardamos a los autores
		 */
		/*
		SearchedAuthorManager sam = new SearchedAuthorManagerImpl();
		sam.save(new SearchedAuthor(getSongAuthor()));
		*/
	}

}
